package com.thiswhyme.targetserver.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author thiswhyme 2020/6/1
 */
@RestController
@RequestMapping("/target")
public class TargetController {

    public static final String HEADER_CURRENT_USER = "CurrentUser";

    @PostMapping("/testZuul")
    public String testZuul(@RequestBody String param, HttpServletRequest request) {
        return new StringBuffer().append("request received")
                .append("\n")
                .append("param is: ")
                .append(param)
                .append("\n")
                .append("currentUser is: ")
                .append(request.getHeader(HEADER_CURRENT_USER))
                .toString();
    }
}
